package XZK010201;

/**
 * 面向对象基础训练
 *
 * @author bing.z 2021/5/28 15:29
 **/
public class Demo {
    public static void main(String[] args) {
        /**
         * 1、编写 Car 类，属性有品牌（brand）和颜色（Color），定义 show 方
         * 法，打印所有属性。
         */
        Car car = new Car("Nike","黑色");
        car.show();

        /**
         * 2、定义一个游戏类，包括游戏的属性包括：游戏名，类型，大小，星级，
         * 介绍等，可以调用方法输出游戏的介绍。
         */
        Game game = new Game();
        game.setIntroduction("这是一个游戏的介绍");
        System.out.println(game.getIntroduction());

        /**
         * 3、定义并测试一个代表员工的 Employee 类。它的属性包括“员工姓名”、
         * “员工号码”、“员工基本薪水”、“员工薪水增长率”；他的方法包括“构造方法”、“获
         * 取员工姓名”、“获取员工号码”、“获取员工基本薪水”、“计算薪水增长额”及“计
         * 算增长后的工资总额”。
         */
        Employee employee = new Employee("张三", 1001, 1000.0, 0.3);
        System.out.println(employee.getNextSalary());

    }
}

class Employee {
    private String empName;
    private Integer empNo;
    private Double baseSalary;
    private Double salaryGrowthPecent;

    // 自定义方法开始
    public Double getNextSalary() {
        return baseSalary + baseSalary * salaryGrowthPecent;
    }
    // 自定义方法结束

    public Employee(String empName, Integer empNo, Double baseSalary, Double salaryGrowthPecent) {
        this.empName = empName;
        this.empNo = empNo;
        this.baseSalary = baseSalary;
        this.salaryGrowthPecent = salaryGrowthPecent;
    }

    public String getEmpName() {
        return empName;
    }

    public void setEmpName(String empName) {
        this.empName = empName;
    }

    public Integer getEmpNo() {
        return empNo;
    }

    public void setEmpNo(Integer empNo) {
        this.empNo = empNo;
    }

    public Double getBaseSalary() {
        return baseSalary;
    }

    public void setBaseSalary(Double baseSalary) {
        this.baseSalary = baseSalary;
    }

    public Double getSalaryGrowthPecent() {
        return salaryGrowthPecent;
    }

    public void setSalaryGrowthPecent(Double salaryGrowthPecent) {
        this.salaryGrowthPecent = salaryGrowthPecent;
    }
}

class Game {
    private String name;
    private String type;
    private Double size;
    private Integer starLevel;
    private String introduction;

    public String getIntroduction() {
        return introduction;
    }

    public void setIntroduction(String introduction) {
        this.introduction = introduction;
    }
}

class Car {
    private String brand;
    private String color;

    public Car(String brand, String color) {
        this.brand = brand;
        this.color = color;
    }

    void show() {
        System.out.println(brand + "," + color);
    }
}
